`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    09:59:47 12/03/2020 
// Design Name: 
// Module Name:    frozeJudge 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module FrozeJudge(
    input [4:0] useAddress1,
    input [2:0] Tuse1,
	 input [4:0] useAddress2,
    input [2:0] Tuse2,
	 input [4:0] newAddress1,
    input [2:0] Tnew1,
    input [4:0] newAddress2,
    input [2:0] Tnew2,
    input [4:0] newAddress3,
    input [2:0] Tnew3,
    output reg froze
    );
	reg	[3:0]grf[31:0];
	integer i;
	always @*
	begin
		for(i=0;i<32;i=i+1)
			grf[i] = 0;
		grf[newAddress3] = (newAddress3 == 0) ? 0 : Tnew3;
		grf[newAddress2] = (newAddress2 == 0) ? 0 : Tnew2;
		grf[newAddress1] = (newAddress1 == 0) ? 0 : Tnew1;
		if(Tuse1 < grf[useAddress1] || Tuse2 < grf[useAddress2])
			froze = 1;
		else	froze = 0;
	end

endmodule
